/*
 * UserInfoBean.java
 * 
 * Copyright (c) 2011 Administrator. 
 * 
 * This file is part of RMS.
 * 
 * RMS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * RMS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with RMS.  If not, see <http ://www.gnu.org/licenses/>.
 */

package com.itrustsolution.rms.managedbean;

import java.io.IOException;
import java.util.Date;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Administrator
 */
public class UserInfoBean {

    /** Creates a new instance of UserInfoBean */
    public UserInfoBean() {
    }
    
    private Date startLogin = new Date();
    private String loginName = "";
    private boolean superAdmin = false;
    
    public String logout_action() throws IOException
    {
        System.out.println("[UserInfoBean][logout_action] start");
        ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
//        HttpServletResponse response = (HttpServletResponse) ec.getResponse();
        HttpSession session = (HttpSession) ec.getSession(false);
        session.invalidate();
//        response.sendRedirect("/login.xhtml");
        System.out.println("[UserInfoBean][logout_action] end");
        return "login";
    }
    
    /**
     * Helper view untuk User
     */
//    private SecUsersView user = null;
    
    /**
     * Collection page page yang dimiliki user
     */
//    private Set<String> viewIds = new HashSet<String>();
    
    
    
    
    public void setStartLogin(Date startLogin)
    {
        this.startLogin = startLogin;
    }

    public Date getStartLogin()
    {
        return startLogin;
    }

    public void setLoginName(String loginName)
    {
        this.loginName = loginName;
    }

    public String getLoginName()
    {
        return loginName;
    }

    public void setSuperAdmin(boolean superAdmin)
    {
        this.superAdmin = superAdmin;
    }

    public boolean isSuperAdmin()
    {
        return superAdmin;
    }

    
}
